﻿Imports DTO
Imports System.Data.OleDb
Public Class LoaiKhachDAO
    Public Shared Function LayDanhSach() As List(Of LoaiKhach)
        Dim ds As New List(Of LoaiKhach)
        Dim sql As String = "select * from LOAIKHACH"
        Dim rd As OleDbDataReader = Dataprovider.ExecuteReader(sql)
        While (rd.Read())
            Dim loaikhach As New LoaiKhach
            loaikhach.MaLoaiKhach = rd.GetInt32(0)
            loaikhach.TenKhach = rd.GetString(1)
            ds.Add(loaikhach)
        End While
        Return ds
    End Function
    Public Shared Function LayMaLoaiKhachNuocNgoai() As Integer
        Dim sql As String = "select MaLoaiKhach from LOAIKHACH where TenLoaiKhach like '%nước ngoài%'"
        Return Integer.Parse(Dataprovider.ExecuteScalar(sql))
    End Function
End Class
